/**
 * 练习1.求1-100间的质数
*/

#include <iostream>
#include <cmath>

int main(void)
{
  int count = 0;
  for (int i = 2; i <= 100; i++)
  {
    bool flag = true;
    int l = floor(sqrt(i));
    // std::cout << "i : " << i << " l :" << l << std::endl;
    for (int j = 2; j <= l; j++)
    {
      if (i % j == 0)
      {
        // std::cout << i << "不是质数" << std::endl;
        flag = false;
        break;
      }
    }
    if (flag)
    {
      std::cout << i << "是质数" << std::endl;
      count++;
    }
  }
  std::cout << "一共有" << count << "个质数" << std::endl;
  printf("----------end-----------\n");
  return 0;
}